import tpl from './local.html'

export const getBaseTpl = () => {
  return tpl
}

export const getTpl = (ops) => {
  const { data, methods, template, script, style } = ops
  let content = getBaseTpl()
  content = content.replace('<%=style%>', style || '')
  content = content.replace('<%=script%>', script || '')
  content = content.replace('<%=template%>', template || '')
  content = content.replace('<%=data%>', JSON.stringify(data || {}))
  content = content.replace('<%=methods%>', methods || {})

  return content
}
